<template>
  <div class="commission_detail-container">
    <breadcrumb style="position: absolute;width:100%;"></breadcrumb>
    <img src="../../img/return_icon.png" alt @click="$router.go(-1)">

    <div class="content">
      <div class="query">
        <div class="right">
            <el-button type='primary' @click="Fan">返回</el-button>
        </div>
      </div>
      <div class="table" v-if="list">
        <el-table :data="detailList" style="width: 100%" height="528">
          <el-table-column prop="applyCommission" label="佣金金额"></el-table-column>
          <el-table-column label="提现到">
            <template slot-scope="scope">
              <div class="cell">{{scope.row.onlineType == 0 ? '账号余额':'提现到银行卡'}}</div>
            </template>
          </el-table-column>
          <el-table-column prop="accountCommission" label="实际到账"></el-table-column>
          <el-table-column prop="applyTime" label="申请时间"></el-table-column>
          <el-table-column label="转出状态">
            <template slot-scope="scope">
              <div class="cell">{{scope.row.examineStatus == 0 ? '审核中':'通过'}}</div>
            </template>
          </el-table-column>
        </el-table>
        <pagination
          :currentPage="currentPage"
          :page="page"
          :total="total"
          :pageSize="pageSize"
          @change-current="currentChange"
          @change-size="sizeChange"
        ></pagination>
      </div>
       <div class="table" v-if="lists">
        <el-table :data="detailList" style="width: 100%" height="528">
          <!-- <el-table-column prop="teamLevel" label="团队"></el-table-column> -->
          <el-table-column  label="团队">
            <template slot-scope="scope">
              <div class="cell">
                {{scope.row.teamLevel == 1 ? '一级团队': '二级团队'}}
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="teamUserId" label="用户ID"></el-table-column>
          
          <el-table-column prop="" label="类型"></el-table-column>
          <el-table-column prop="commissionSum" label="佣金金额（元）"></el-table-column>
          <el-table-column prop=" transactionNo" label="订单号"></el-table-column>
          <el-table-column prop="sysTime" label="消费时间"></el-table-column>
          
        </el-table>
        <pagination
          :currentPage="currentPage"
          :page="page"
          :total="total"
          :pageSize="pageSize"
          @change-current="currentChange"
          @change-size="sizeChange"
        ></pagination>
      </div>
    </div>
  </div>
</template>

<script>
import breadcrumb from "../../components/breadcrumb";
import pagination from "../../components/page";
import {commission_detail} from '../../api/getData'
export default {
  components: { breadcrumb, pagination },
  data() {
    return {
      page: 1,
      userId: this.$route.query.id,
      currentPage: 1,
      pageSize: 10,
      total: 0,
      username: "",
      startTime:'',
      endTime:'',
      levelOneNum:'',
      levelTwoNum:'',
      commissionSum:'',
      detailList: [],
      list:true,//提现明细的显示和影藏
      lists:false,//佣金获得明细的显示和隐藏
    };
  },
  created() {
    this.get_commission_detail()
  },
  methods: {
    sizeChange(val) {
      this.pageSize = val;
      this.currentPage = 1;
      this.get_commission_detail()
    },
    currentChange(val) {
      this.currentPage = val;
      this.get_commission_detail()

    },
    get_commission_detail(currentPage){
      if(currentPage){
        this.currentPage = currentPage
      }
      // let data = 'endTime=' + this.endTime + "&startTime=" + this.startTime + '&userId=' + this.userId + '&size=' + this.pageSize + '&current=' + this.currentle't
      let data ="userId="+this.userId+"&current="+this.currentPage;
      commission_detail(data).then(res => {
        //console.log(res,'单个')
        if(res.data.status == 0 && res.data.data.records.length != 0){
          this.total = res.data.data.total 
          this.page = Math.ceil(this.total / this.pageSize)
          this.detailList = res.data.data.records
          this.levelOneNum = res.data.data.records[0].levelOneNum
          this.levelTwoNum=res.data.data.records[0].levelTwoNum
          this.commissionSum =res.data.data.records[0].commissionSum
        }
      })
    },
    //控制提现明细的显示和
    getList(){
        this.list=!this.list
        this.lists=!this.lists
    },
    //控制佣金获得明细
    getLists(){
        this.lists=!this.lists
        this.list=!this.list
    },
    //点击返回上一级页面
    Fan(){
        this.$router.go(-1)
    }
  }
};
</script>


<style lang="less" >
.commission_detail-container {
  @import "../../style/table.less";
  @import "../../style/content.less";
  display: flex;
  flex-flow: column;
  position: relative;
  height: 100%;
  .el-table .cell {
    white-space: pre-line !important;
  }
  > img {
    position: absolute;
    width: 30px;
    height: 30px;
    top: 5px;
    right: 40px;
    z-index: 99;
    cursor: pointer;
  }
  .content {
    .query {
      .btn {
        .el-button {
          width: 70px;
        }
      }
      .start_time {
        display: flex;
        align-items: center;
      }
      .end_time {
        display: flex;
        align-items: center;
      }
    }
  }
}
</style>
